package com.motong.gongdan.constant;


import java.util.HashMap;
import java.util.Map;

/**
 * 通用常量
 */
public class CommonConstant {

    public static Map<String, String> WORK_ORDER_CONDITION_MERGE_RULE = new HashMap<>(25);

    public static Map<String, String> MISSION_CONDITION_MERGE_RULE_PC = new HashMap<>(19);

    public static Map<String, String> STOCK_BALANCE_CONDITION_MERGE_RULE = new HashMap<>(15);

    public static Map<String, String> WORK_REPORT_CONDITION_MERGE_RULE = new HashMap<>(17);

    public static Map<String, String> PRODUCE_REPORT_MERGE_RULE = new HashMap<>(40);

    static {
        WORK_ORDER_CONDITION_MERGE_RULE.put("code", "apposition");
        WORK_ORDER_CONDITION_MERGE_RULE.put("productCode", "apposition");
        WORK_ORDER_CONDITION_MERGE_RULE.put("productName", "apposition");
        WORK_ORDER_CONDITION_MERGE_RULE.put("productSpecification", "apposition");
        WORK_ORDER_CONDITION_MERGE_RULE.put("unit", "deprecated");
        WORK_ORDER_CONDITION_MERGE_RULE.put("comment", "apposition");
        WORK_ORDER_CONDITION_MERGE_RULE.put("planedNumberDown", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("planedNumberUp", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("actualNumberDown", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("actualNumberUp", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("goodProductNumberDown", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("goodProductNumberUp", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("badProductNumberDown", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("badProductNumberUp", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("startTimeStart", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("startTimeEnd", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("endTimeStart", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("endTimeEnd", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("actualStartTimeStart", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("actualStartTimeEnd", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("actualEndTimeStart", "max");
        WORK_ORDER_CONDITION_MERGE_RULE.put("actualEndTimeEnd", "min");
        WORK_ORDER_CONDITION_MERGE_RULE.put("state", "listIntersection");
        WORK_ORDER_CONDITION_MERGE_RULE.put("ids", "listIntersection");
        WORK_ORDER_CONDITION_MERGE_RULE.put("unitIdList", "listIntersection");


        MISSION_CONDITION_MERGE_RULE_PC.put("id", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("workOrderCode", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("processCode", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("processName", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("startTime", "max");
        MISSION_CONDITION_MERGE_RULE_PC.put("endTime", "min");
        MISSION_CONDITION_MERGE_RULE_PC.put("actualStartTime", "max");
        MISSION_CONDITION_MERGE_RULE_PC.put("actualEndTime", "min");
        MISSION_CONDITION_MERGE_RULE_PC.put("productCode", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("productName", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("productSpecification", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("processState", "listIntersection");
        MISSION_CONDITION_MERGE_RULE_PC.put("distributionState", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("workOrderState", "listIntersection");
        MISSION_CONDITION_MERGE_RULE_PC.put("permission", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("distribution", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("distributionsList", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("isDelay", "stringCompareDeprecated");
        MISSION_CONDITION_MERGE_RULE_PC.put("missionIds", "listIntersection");
        MISSION_CONDITION_MERGE_RULE_PC.put("workOrderIds", "listIntersection");


        STOCK_BALANCE_CONDITION_MERGE_RULE.put("ids", "listIntersection");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("productName", "stringCompareDeprecated");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("productCode", "stringCompareDeprecated");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("productSpecification", "stringCompareDeprecated");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("attribute", "stringCompareDeprecated");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("stock", "stringCompareDeprecated");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("maximumDown", "max");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("maximumUp", "min");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("minimumDown", "max");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("minimumUp", "min");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("safeDown", "max");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("safeUp", "min");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("typeOther", "stringCompareDeprecated");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("numDown", "max");
        STOCK_BALANCE_CONDITION_MERGE_RULE.put("numUp", "min");

        WORK_REPORT_CONDITION_MERGE_RULE.put("workOrderCode", "stringCompareDeprecated");
        WORK_REPORT_CONDITION_MERGE_RULE.put("productCode", "stringCompareDeprecated");
        WORK_REPORT_CONDITION_MERGE_RULE.put("productName", "stringCompareDeprecated");
        WORK_REPORT_CONDITION_MERGE_RULE.put("productSpecification", "stringCompareDeprecated");
        WORK_REPORT_CONDITION_MERGE_RULE.put("userIds", "listIntersection");
        WORK_REPORT_CONDITION_MERGE_RULE.put("processState", "listIntersection");
        WORK_REPORT_CONDITION_MERGE_RULE.put("processName", "stringCompareDeprecated");
        WORK_REPORT_CONDITION_MERGE_RULE.put("reportStartTimeStart", "max");
        WORK_REPORT_CONDITION_MERGE_RULE.put("reportStartTimeEnd", "min");
        WORK_REPORT_CONDITION_MERGE_RULE.put("reportEndTimeStart", "max");
        WORK_REPORT_CONDITION_MERGE_RULE.put("reportEndTimeEnd", "min");
        WORK_REPORT_CONDITION_MERGE_RULE.put("actualReportStartTime", "max");
        WORK_REPORT_CONDITION_MERGE_RULE.put("actualReportEndTime", "min");
        WORK_REPORT_CONDITION_MERGE_RULE.put("verifyState", "listIntersection");
        WORK_REPORT_CONDITION_MERGE_RULE.put("pricingMethod", "listIntersection");
        WORK_REPORT_CONDITION_MERGE_RULE.put("ids", "listIntersection");
        WORK_REPORT_CONDITION_MERGE_RULE.put("id", "stringCompareDeprecated");


        PRODUCE_REPORT_MERGE_RULE.put("actualEndTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("actualEndTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("badProduct", "listIntersection");
        PRODUCE_REPORT_MERGE_RULE.put("comment", "stringCompareDeprecated");
        PRODUCE_REPORT_MERGE_RULE.put("depIds", "listIntersection");
        PRODUCE_REPORT_MERGE_RULE.put("missionActualEndTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("missionActualEndTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("missionActualStartTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("missionActualStartTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("missionEndTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("missionEndTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("missionStartTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("missionStartTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("missionState", "listIntersection");
        PRODUCE_REPORT_MERGE_RULE.put("pricing", "stringCompareDeprecated");
        PRODUCE_REPORT_MERGE_RULE.put("processIds", "listIntersection");
        PRODUCE_REPORT_MERGE_RULE.put("produceUser", "listIntersection");
        PRODUCE_REPORT_MERGE_RULE.put("productName", "stringCompareDeprecated");
        PRODUCE_REPORT_MERGE_RULE.put("reportEndTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("reportEndTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("reportStartTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("reportStartTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("specification", "stringCompareDeprecated");
        PRODUCE_REPORT_MERGE_RULE.put("verifyState", "stringCompareDeprecated");
        PRODUCE_REPORT_MERGE_RULE.put("verifyTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("verifyTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("verifyUser", "listIntersection");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderActualStartTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderActualStartTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderCode","stringCompareDeprecated");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderEndTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderEndTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderStartTimeStart", "max");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderStartTimeEnd", "min");
        PRODUCE_REPORT_MERGE_RULE.put("workOrderState", "listIntersection");
        PRODUCE_REPORT_MERGE_RULE.put("workReportIds", "listIntersection");
    }

    // mqtt Topic前缀
    public final static String MQTT_PREFIX = "sys/device/system/MonitorData/";

    //redis缓存前缀
    public final static String REDIS_KEY_PREFIX = "motong:gongdan:";

    // 异常超时上报时间
    public final static String EXCEPTION_TIMEOUT_HASH_KEY = REDIS_KEY_PREFIX.concat("exception:timeout");

    // 超时上报默认时长
    public final static Long EXCEPTION_TIMEOUT_DEFAULT_MINUTE = 1L;

    // 设备计件最后生产时间记录
    public final static String DEVICE_LAST_PRODUCE_TIME_HASH_LEY = REDIS_KEY_PREFIX.concat("device:lastProduceTime");

    public final static String DEVICE_LAST_PRODUCE_LOG = REDIS_KEY_PREFIX.concat("device:lastProduceLog");

    /*-------------------排序缓存常量-------------------------*/
    public final static String H5_DASHBOARD_H5ORDER_SORT_CONDITION_NAME = "h5:dashboard:h5OrderList";

    public final static String H5_ASSEMBLY_LIST_SORT_CONDITION_NAME = REDIS_KEY_PREFIX.concat("h5:assembly:list");

    // 排序条件缓存hashkey
    public final static String ORDER_CONDITION_HASH_KEY = REDIS_KEY_PREFIX.concat("orderByCondition");

    /*-------------------条件缓存常量-------------------------*/
    // 查询条件缓存hashkey
    public final static String SEARCH_CONDITION_HASH_KEY = REDIS_KEY_PREFIX.concat("searCondition");

    // 报工看板已查询缓存
    public final static String WORK_REPORT_DASHBOARD_SEARCHED_ID_CACHE = REDIS_KEY_PREFIX.concat("workReportDashboardSearchedIds");

    // h5 AccessToken
    public final static String H5_ACCESS_TOKEN = REDIS_KEY_PREFIX.concat("h5:accessToken");
}
